Make the VTPM.destroy method return 'void' upon success and adapt the
authorEwan Mellor <ewan@xensource.com>
Fri, 9 Mar 2007 02:32:52 +0000 (02:32 +0000)
committerEwan Mellor <ewan@xensource.com>
Fri, 9 Mar 2007 02:32:52 +0000 (02:32 +0000)
test case to reflect that.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
tools/python/xen/xend/XendAPI.py
tools/xm-test/tests/vtpm/09_vtpm-xapi.py

index 69ebb3f34106542419d854a61de97c99a3fc315f..c89f5467d06fe9b539cdabaedd7d0c72916e6f46 100644 (file)
@@ -1926,7 +1926,7 @@ class XendAPI(object):
                  XendDomain.POWER_STATE_NAMES[dom.state]])
             from xen.xend.server import tpmif
             tpmif.destroy_vtpmstate(dom.getName())
-            return xen_api_success(True)
+            return xen_api_success_void()
         else:
             return xen_api_error(['HANDLE_INVALID', 'VM', vtpm_struct['VM']])
 
index 6a17c510455b8276b2704bbaa0d6c8d399dde256..6de28805d3ad48992d327a11de14f56997671767 100644 (file)
@@ -113,7 +113,7 @@ if not re.search("PCR-00:",run["output"]):
     FAIL("1. Virtual TPM is not working correctly on /dev/vtpm on backend side: \n%s" % run["output"])
 
 try:
-    rc = session.xenapi.VTPM.destroy(vtpm_uuid)
+    session.xenapi.VTPM.destroy(vtpm_uuid)
     #Should never get here
     FAIL("Could destroy vTPM while VM is running")
 except:
@@ -124,7 +124,7 @@ if rc:
     FAIL("Could not suspend VM")
 
 try:
-    rc = session.xenapi.VTPM.destroy(vtpm_uuid)
+    session.xenapi.VTPM.destroy(vtpm_uuid)
     #May not throw an exception in 'suspend' state
 except:
     pass
@@ -150,8 +150,9 @@ if not re.search("PCR-00:",run["output"]):
 
 domain.stop()
 
-rc = session.xenapi.VTPM.destroy(vtpm_uuid)
-if not rc:
+try:
+    session.xenapi.VTPM.destroy(vtpm_uuid)
+except:
     FAIL("Could NOT destroy vTPM while domain is halted.")
 
 domain.destroy()